home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-08-29 | 38.3 KB | 1,787 lines |
-
-
-
-
-
-
-
-
-
-
-
-
- Chapter 1
-
- GETTING STARTED WITH PROTOCOLS
-
-
- 1.1 INTRODUCTION
-
-
- The LiteComm protocol engines are designed to simplify the task
- of moving large quantities of information over communications
- lines. Since communications lines are notoriously subject to
- noise, each of the engines imposes a protocol or set of rules
- that help insure the integrity of the information. Since the
- rules that are used are necessarily complex, the engines remove
- many of the concerns that normally confront programmers.
-
- You can see the application of many of the concepts that we
- discuss in the sample program QBTTL. QBTTL is distributed, in
- both source and executable forms, as part of the LiteComm
- package. You should review QBTTL carefully for additional
- understanding.
-
-
- 1.2 BASIC ENGINE INTERFACE
-
-
- Several protocol engines are included as part of LiteComm. They
- include:
-
- o XModem
-
- o XModem-1K
-
- o Windowed XModem
-
- o YModem
-
- o ZModem
-
- Each of these protocol has its own strengths and weaknesses. And
- each has very different rules. Yet, we have attempted to make the
- programming for each as common as possible, whenever practical.
-
- To use any of the protocol engines, you must follow a series of
- steps. Unless indicated otherwise, these steps are required
- regardless of the protocol that is being employed.
-
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- 1.2.1 PROTOCOL INITIALIZATION
-
- The initialization phase for the protocol engines requires two
- essential steps, plus several optional steps depending upon your
- applications needs.
-
- 1. Open a communication port using the comm_opn function. You
- must specify buffer sizes at least as large as the size of
- a protocol transfer block. For XModem and Windowed XModem,
- the buffers must be at least 128 bytes. For XModem-1K,
- YModem, and ZModem, the buffers must be at least 1024 (1K)
- bytes. In general, we use 2K buffers for most
- applications, assuming that there is adequate memory to
- support this buffer size.
-
- 2. Set the port parameters to NO PARITY, 8 DATA BITS. This
- can be done when the port is originally opened, or by
- using the lc_setup function.
-
- 3. Disable software (XON-XOFF) flow control, if it has been
- activated. In general, XModem, XModem-1K, and YModem
- cannot tolerate software flow control. Windowed XModem and
- ZModem are designed to work with software flow control.
-
- 4. Allocate a protocol control block (pcb) for the port,
- using the lcp_alloc function. The lcp_alloc function
- builds the essential control structures that are used by
- the protocol engines. Once allocated, a pcb may be reused
- as often as required without using the lcp_free function.
-
- 5. Initialize the pcb by calling the lcp_setproto function.
- This function establishes the starting values for the
- requested protocol. The lcp_setproto function should be
- called before initiating each protocol session.
-
- 6. Optionally install an abort function that can cause the
- engine to abort a transfer session, based upon an event
- you define. One such event might be the recognition of a
- keystroke, such as ESC, to permit the user to abort
- protocol operations.
-
- 7. Optionally install a status function that can process
- status messages being issued by the engine. Your
- application might use this function to display appropriate
- messages to the user.
-
- 8. Optionally use the lcp_setsignal macro to inform the
- protocol engines that you to monitor that signal. If you
- use this facility, the protocol engines will abort
- operation if the signal is not present.
-
-
-
-
-
-
-
- Page 2
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- 1.2.2 DATA TRANSFER
-
- The method employed to actually transfer data is dependent upon
- the protocol in use. The XModem, XModem-1K, and Windowed XModem
- protocols place the burden on the programmer to read data from
- and write data to the disk. See QBTTL for examples of this
- interface.
-
- Due to the added complexity, both the YModem and ZModem engines
- handle all aspects of file transfers. You simply provide a list
- of files to send, or a path to which to store files and the
- engines do the rest.
-
- 1.2.3 PROTOCOL SHUTDOWN
-
- Shutting down a protocol engine simply requires that you use the
- lcp_free function to release the memory reserved by lcp_alloc. Do
- not attempt to use the compiler's free function to do this. All
- reserved memory will not be released by free.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 3
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 4
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- Chapter 2
-
- INITIALIZATION DETAILS
-
-
- 2.1 THE MANDATORY FUNCTIONS
-
-
- The two essential initialization functions are lcp_alloc and
- lcp_setproto. Use of both functions is absolutely essential for
- successful engine operation.
-
- 2.1.1 LCP_ALLOC
-
- Function lcp_alloc sets aside memory for a protocol control block
- or pcb. A pcb is defined the lcproto.h header file as a type
- definition or typedef of PROTO. Once the pcb is built, a transfer
- buffer is allocated for use by the protocol engines, and is
- associated with the pcb.
-
- We take pains to inform you of the details for two reasons:
-
- o To convince you that it is to your advantage to use the
- match lcp_free function to release the pcb.
-
- o To help you understand that multiple pcb's will use
- significant amounts of system memory. For example, the
- transfer buffer is about 2K bytes long, regardless of the
- protocol that is being used.
-
- o While you may access the values contained in the pcb, your
- program should never attempt to alter the values found
- there, unless you are absolutely certain about what you
- are doing.
-
- Due to a design decision, you need only construct a pcb once
- during the program. The pcb is reusable from transfer session to
- session. It is not necessary to use lcp_free between transfer
- sessions.
-
- 2.1.2 LCP_SETPROTO
-
- The lcp_setproto function actually does the initialization work.
- When you call lcp_setproto, the function initializes the target
- pcb with the correct values for the selected protocol. Since
- lcp_setproto does do initialization, you must use lcp_setproto
- before each transfer session. Failure to observe this restriction
- may result in failure of the transfer with unexpected results.
-
-
-
- Page 5
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- 2.2 THE OPTIONAL STEPS
-
-
- 2.2.1 ABORT FUNCTION
-
- Each of the protocol engines periodically calls an abort
- function. By default, this is a do-nothing function that simply
- satisfies the linker. But if you wish, you may install an abort
- handler of your own. The function must be of type ABORTFUNC, as
- defined in lcproto.h.
-
- The reason for the abort function is to give you a hook into the
- engines. The abort function takes no arguments. To inform the
- engine that you wish to abort a transfer in progress, your abort
- function should return a nonzero value. To let the transfer
- continue, your function should return a value of zero.
-
- If you intend to use an abort function please keep this in mind.
- All of the protocols are time-sensitive to a greater or lesser
- degree. Your abort function should execute as quickly as
- possible, with a minimum of delay.
-
- If you want to use an abort function, simply assign your function
- to lcp_abort. Lcp_abort is defined within lcproto, the protocol
- common code, as shown below:
-
- lcp_abort = my_abort;
-
- before the transfer session is started.
-
- 2.2.2 STATUS FUNCTION
-
- Like the abort function, the protocol engines provide a second
- hook for monitoring progress and status information. By default,
- LiteComm engines call a dummy status routine of type STATFUNC. If
- you use a status function of your own, it must be of that type.
-
- A STATFUNC takes three arguments, a message code, an integer
- value, and a void pointer that must be cast, depending upon the
- type of information that is being reported. The meaning of the
- integer and pointer values must be considered in the context of
- the message code.
-
- To help keep things clear, we have developed two tables, below,
- for each of the major protocol groups, the XModem group, and the
- ZModem group.
-
-
-
-
-
-
-
-
-
-
-
- Page 6
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- Table 2.1: XModem Status Codes
-
- CODE INTEGER VALUE POINTER TYPE MEANING
-
- CAN 0 PROTO * Cancel received
- DUPSEQ rec number PROTO * Duplicate block
- EOT 0 PROTO * End of File
- FATAL rec number PROTO * Other fatal error
- RETRIES rec number PROTO * Too many tries
- SUCCESS count of chars PROTO * Block transferred OK
- TOUT 0 PROTO * Timeout
- WAITACK retrys PROTO * Waiting for ack
- WAITBLK retrys PROTO * Waiting for block
- WAITFNB 0 PROTO * Waiting, file name
- WAITHDSK retrys PROTO * Waiting, handshake
- WAITSOH retrys PROTO * Waiting for SOH
- XBADFILE index NULL Can't find file
- XDISKERR count of chars PROTO * Read/Write Error
- XGOTFILE 0 TELINK * Received file name
-
-
- Table 2.2: ZModem Status Codes
-
- CODE INTEGER VALUE POINTER TYPE MEANING
-
- ZBADFILE index NULL Can't find file
- ZBADHDR 0 PROTO * Bad header
- ZBADPOS 0 PROTO * Position error
- ZDISKERR count of chars PROTO * Read/Write error
- ZFCREAT 0 TELINK * Can't create file
- ZFOPEN 0 TELINK * Error opening file
- ZGOTFILE 0 TELINK * Received file name
- ZINITTO 0 PROTO * Init timeout
- ZNOCAR 0 PROTO * Loss of carrier
- ZPKTLEN packet length PROTO * Packet too long
- ZRECOVER 0 TELINK * Attempted recovery
- ZSEEKERR 0 PROTO * File seek error
- ZTIMER 0 PROTO * Timeout Error
- ZXFRCAN 0 PROTO * Transfer cancelled
-
- Of the integer values that are passed, the value specified as
- "index" requires added explanation. The YModem and ZModem send
- functions expect a list of file names to be sent. The index that
- is passed is the number of filename in that list, with zero (0)
- being the first file in the list.
-
- As with the abort function, to implement you own status function,
- assign your function to lcp_status as:
-
- lcp_status = my_status.
-
-
-
-
-
-
-
- Page 7
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- 2.2.3 SIGNAL MONITORING
-
- One of the nastiest problems to deal with in protocol transfers
- is recognizing that the other system is no longer connected.
- Under most protocols, the session will eventually abort due to
- timeout errors. But, depending upon the protocol, a significant
- amount of time may elapse before this happens. In LiteComm's
- implementation of XModem, for example, up to 100 seconds may
- elapse.
-
- As a result, LiteComm engines will optionally monitor one of
- several modem status signals, if you so choose. To cause LiteComm
- to monitor a signal, use the lcp_setsignal macro, as follows:
-
- lcp_setsignal(p, DCD);
-
- In this example, LiteComm will monitor the DCD (carrier detect)
- signal. If carrier is lost, then LiteComm will cancel the
- transfer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 8
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- Chapter 3
-
- FUNCTION REFERENCE
-
-
- 3.1 INTRODUCTION
-
-
- In the information that follows, we describe, in detail, the
- functions used with the protocol engines. We assume that you are
- familiar with standard C notation.
-
- In your use of the functions, we encourage your use of symbolic
- constants whenever possible. Failure to do so make your code
- incompatible with future versions of LiteComm.
-
-
-
-
-
-
- lcp_alloc
-
-
- SUMMARY
-
-
- #include litecomm.h
- #include lcproto.h
-
- PROTO *lcp_alloc(unsigned port);
-
-
- DESCRIPTION
-
-
- Allocates and builds a protocol control block (pcb) of type
- PROTO. Allocates memory for a transfer buffer to be associated
- with the pcb. This function must be used before any other
- protocol-related function. The pcb should only be released with
- the lcp_free function.
-
-
- EXAMPLE
-
-
- PROTO *pcb;
-
-
-
-
- Page 9
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- if ((pcb = lcp_alloc(port)) == NULL)
- {
- puts("Insufficient Memory");
- return;
- }
-
-
- RETURN VALUES
-
-
- The function returns a pointer to the new pcb, or NULL if there
- is not enough heap space to build the pcb and related buffer.
-
-
- SEE ALSO
-
-
- lcp_free
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 10
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcp_free
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
-
- void lcp_free(PROTO *pcb);
-
-
- DESCRIPTION
-
-
- Releases the memory allocated by lcp_alloc. Lcp_free cannot
- determine whether the referenced pcb pointer is valid. Attempting
- to free an improperly allocated pcb will result in unpredictable
- results.
-
-
- RETURN VALUES
-
-
- This function returns no values.
-
-
- SEE ALSO
-
-
- lcp_alloc
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 11
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcp_setproto
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
-
- lcp_setproto(PROTO *pcb, unsigned char protocol, int
- usecrc);
-
-
- DESCRIPTION
-
-
- Initializes the target pcb for a new transfer session using the
- specified protocol. Valid values for protocol are XMODEM,
- XMODEM1K, WXMODEM, YMODEM, and ZMODEM.
-
- The usecrc parameter only has meaning for XMODEM and XMODEM1K.
- For these protocols, a nonzero value tells LiteComm to receive
- using the more effective CRC. A zero value tells LiteComm to
- receive using Checksums.
-
- The function does not check to see if the pcb pointer is valid.
- Use of an invalid pcb pointer will cause unexpected errors.
-
-
- EXAMPLE
-
-
- PROTO *pcb;
-
- if (lcp_setproto(pcb, XMODEM1K, 1) == -1)
- puts("Error setting the protocol");
-
-
- RETURN VALUES
-
-
- The function returns a value of zero if no errors were
- encountered. A return value of -1 indicates that the protocol
- specified is invalid.
-
-
-
-
-
-
-
- Page 12
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcp_setsignal
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
-
- lcp_setsignal(PROTO *p, unsigned char signal);
-
-
- DESCRIPTION
-
-
- This is not a true function, but is rather a macro. The
- specification for signal should be one of the following: DCD,
- CTS, DSR. Only one signal at a time may be specified; they may
- not be OR'ed to monitor multiple signals.
-
- Since this is not a true function, no error checking will be
- performed.
-
-
- RETURN VALUES
-
-
- No values are returned.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 13
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcpxmsnd
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lcpxm.h"
-
- int lcpxmsnd(PROTO *pcb);
-
-
- DESCRIPTION
-
-
- Send a block of data using either XMODEM or XMODEM-1K protocol,
- as determined by the lcp_setproto function. The function
- automatically performs initial handshaking with the target
- system. Upon each call, the contents of pcb->buff, the transfer
- buffer, are sent to the target system. It is the programmers
- responsibility to load the transfer buffer with the appropriate
- amount of data, 128 bytes for XModem, 1024 bytes for XModem-1K,
- before calling lcpxmsnd.
-
- This function is called repeatedly until all data has been
- transferred, or until the transfer is aborted or cancelled. Once
- all data has been sent, the transfer is ended by calling the
- function lcxteot.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- The significant return values, and there related actions are
- shown below:
-
- o SUCCESS - Block was sent successfully. Send the next block
- or EOT.
-
- o CAN - The receiving system has requested that the transfer
- be cancelled. No further action is necessary.
-
-
-
- Page 14
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- o RETRIES - The block could not be sent successfully after
- 10 attempts. No further action is possible.
-
- o All Others - A fatal condition was detected. No further
- action is possible.
-
-
- SEE ALSO
-
-
- lcp_setproto, lcxteot
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 15
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcpxmrec
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lcpxm.h"
-
- int lcpxmrec(PROTO *pcb);
-
-
- DESCRIPTION
-
-
- Receive a block of data using XMODEM or XMODEM-1K. All initial
- handshaking with the sending system is done automatically. If a
- block is successfully received, it will be in the transfer buffer
- at pcb->buff. The length of the received block will be in
- pcb->rbsize. It is the responsibility of the programmer to write
- the contents of the transfer buffer to disk.
-
- The function is called repeatedly until the transfer is
- cancelled, aborted, or completed.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- The significant return values, and there related actions are
- shown below:
-
- o SUCCESS - Block was received successfully. Write the block
- to disk and attempt to receive the next block.
-
- o DUPSEQ - The block received was a duplicate of the
- previous block. Ignore the block and attempt to receive
- the next block.
-
- o CAN - The receiving system has requested that the transfer
- be cancelled. No further action is necessary.
-
-
-
- Page 16
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- o EOT - There is no more data to receive, end of file has
- been reached. No further action is necessary.
-
- o TOUT - While waiting for a block from the sending system,
- too much time elapsed, approximately 100 seconds. No
- further action is possible.
-
- o RETRIES - The block could not be received successfully
- after 10 attempts. No further action is possible.
-
- o All Others - A fatal condition was detected. No further
- action is possible.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 17
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcpwxsnd
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lcpxm.h"
-
- int lcpwxsnd(PROTO *pcb, int *nrec);
-
-
- DESCRIPTION
-
-
- Send a block of data using the Windowed XModem protocol.
-
- This function is called repeatedly to transfer data to the
- receiving system. It is the responsibility of the programmer to
- fill the transfer buffer located at pcb->buff with 128 bytes of
- data before each call. In addition, for each block of data, the
- contents of the variable nrec must be set to zero.
-
- If a block is transferred successfully, the function is called
- again to send the next block of data. When all data has been
- sent, the function is called with nrec set to a value of -1 to
- signify end of file.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- The significant return values, and there related actions are
- shown below. Please note that, under some circumstances, the
- value of nrec has importance.
-
- o SUCCESS - Block was sent successfully. If nrec has a value
- of -1, the receiving system has acknowledged End Of File,
- and no further action is needed. Otherwise, send the next
- block or signal end of file by setting nrec to -1.
-
-
-
-
- Page 18
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- o CAN - The receiving system has requested that the transfer
- be cancelled. No further action is necessary.
-
- o RETRIES - The block could not be sent successfully after
- 10 attempts. No further action is possible.
-
- o RESEND - The receiving system has requested that you
- retransmit date beginning with the block specified by
- nrec. You must reposition the file to the specified block
- and begin sending from that point. The location of the
- start of the block is calculated by multiplying the value
- of nrec by 128. The result should always be a long
- integer.
-
- o All Others - A fatal condition was detected. No further
- action is possible.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 19
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcpwxrec
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lcpxm.h"
-
- int lcpwxrec(PROTO *pcb, int *nrec);
-
-
- DESCRIPTION
-
-
- Receive a block of data using the Windowed XModem protocol.All
- initial handshaking with the sending system is done
- automatically. If a block is successfully received, it will be in
- the transfer buffer at pcb->buff. The length of the received
- block will always be 128 bytes. It is the responsibility of the
- programmer to write the contents of the transfer buffer to disk.
-
- The function is called repeatedly until the transfer is
- cancelled, aborted, or completed.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- The significant return values, and there related actions are
- shown below. Please note that, under some circumstances, the
- value of nrec has importance.
-
- o SUCCESS - Block was received successfully. Write the block
- to disk and attempt to receive the next block.
-
- o DUPSEQ - The block received was a duplicate of the
- previous block. Ignore the block and attempt to receive
- the next block.
-
-
-
-
-
- Page 20
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
- o CAN - The receiving system has requested that the transfer
- be cancelled. No further action is necessary.
-
- o EOT - There is no more data to receive, end of file has
- been reached. No further action is necessary.
-
- o TOUT - While waiting for a block from the sending system,
- too much time elapsed, approximately 100 seconds. No
- further action is possible.
-
- o RETRIES - The block could not be received successfully
- after 10 attempts. No further action is possible.
-
- o All Others - A fatal condition was detected. No further
- action is possible.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 21
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcym_send
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lcpxm.h"
-
- int lcym_send(PROTO *pcb, char **filelist);
-
-
- DESCRIPTION
-
-
- Send one or more files using YModem protocol.
-
- Due to the complexities of batch transfers, the programmer must
- create a list of file names to be transferred. QBTTL shows one
- approach to building the list. This is not necessarily the best
- approach. The file list must end with a zero length file name.
-
- Once called, all files will be sent to the receiving system,
- unless the transfer is canceled or aborted.
-
- MSC USERS NOTE: The files to be transferred should be either in
- the default directory, or in a directory specified in the PATH
- environment variable.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- This function returns no values.
-
-
-
-
-
-
-
-
-
-
- Page 22
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lcym_recv
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lcpxm.h"
-
- int lcym_recv(PROTO *pcb, char *storagepath);
-
-
- DESCRIPTION
-
-
- Receive one or more files using YModem protocol.
-
- The storagepath variable must be the path to the directory in
- which received files will be placed. It must be of the form
-
- C:\DIR1\DIR2\
-
- The trailing '\' is significant and required.
-
- Once called, all files will be received from the send system,
- unless the transfer is canceled or aborted.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- This function returns no values.
-
-
-
-
-
-
-
-
-
-
-
-
- Page 23
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lczm_send
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lczm.h"
-
- int lczm_send(PROTO *pcb, char **filelist);
-
-
- DESCRIPTION
-
-
- Send one or more files using ZModem protocol.
-
- Due to the complexities of batch transfers, the programmer must
- create a list of file names to be transferred. QBTTL shows one
- approach to building the list, though not necessarily the best
- approach. The file list must end with a zero length file name.
-
- Once called, all files will be sent to the receiving system,
- unless the transfer is canceled or aborted.
-
- MSC USERS NOTE: The files to be transferred should be either in
- the default directory, or in a directory specified in the PATH
- environment variable.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- This function returns no values.
-
-
-
-
-
-
-
-
-
-
- Page 24
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
- LITECOMM (TM) COMMUNICATIONS TOOLBOX
- Protocol Engines
-
-
-
-
-
-
-
-
-
- lczm_recv
-
-
- SUMMARY
-
-
- #include "litecomm.h"
- #include "lcproto.h"
- #include "lczm.h"
-
- int lczm_recv(PROTO *pcb, char *storagepath);
-
-
- DESCRIPTION
-
-
- Receive one or more files using ZModem protocol.
-
- The storagepath variable must be the path to the directory in
- which received files will be placed. It must be of the form
-
- C:\DIR1\DIR2\
-
- The trailing '\' is significant and required.
-
- Once called, all files will be received from the send system,
- unless the transfer is canceled or aborted.
-
-
- EXAMPLE
-
-
- See QBTTL.
-
-
- RETURN VALUES
-
-
- This function returns no values.
-
-
-
-
-
-
-
-
-
-
-
-
- Page 25
- Copyright (c) 1987 - 1991 Information Technology, Ltd.
-
-
-
-
-
-
-
-
-
-
-
- Contents
-
-
-
- Chapter 1 GETTING STARTED WITH PROTOCOLS 1
- 1.1 INTRODUCTION . . . . . . . . . . . . . . . . 1
- 1.2 BASIC ENGINE INTERFACE . . . . . . . . . . . 1
- 1.2.1 PROTOCOL INITIALIZATION . . . . . . . . 2
- 1.2.2 DATA TRANSFER . . . . . . . . . . . . . 3
- 1.2.3 PROTOCOL SHUTDOWN . . . . . . . . . . . 3
-
- Chapter 2 INITIALIZATION DETAILS 5
- 2.1 THE MANDATORY FUNCTIONS . . . . . . . . . . . 5
- 2.1.1 LCP_ALLOC . . . . . . . . . . . . . . . 5
- 2.1.2 LCP_SETPROTO . . . . . . . . . . . . . . 5
- 2.2 THE OPTIONAL STEPS . . . . . . . . . . . . . 6
- 2.2.1 ABORT FUNCTION . . . . . . . . . . . . . 6
- 2.2.2 STATUS FUNCTION . . . . . . . . . . . . 6
- 2.2.3 SIGNAL MONITORING . . . . . . . . . . . 8
-
- Chapter 3 FUNCTION REFERENCE 9
- 3.1 INTRODUCTION . . . . . . . . . . . . . . . . 9
-
- lcp_alloc 9
-
- lcp_free 11
-
- lcp_setproto 12
-
- lcp_setsignal 13
-
- lcpxmsnd 14
-
- lcpxmrec 16
-
- lcpwxsnd 18
-
- lcpwxrec 20
-
- lcym_send 22
-
- lcym_recv 23
-
- lczm_send 24
-
- lczm_recv 25
-
-
-
-
-
- i
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ii
-
-
-
-
-
-
-
-
-
-
-
-
- Tables
-
-
- Table 2.1: XModem Status Codes . . . . . . . . . . . 7
- Table 2.2: ZModem Status Codes . . . . . . . . . . . 7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- iii
-